const mongoose = require('mongoose');
//connect 方法的返回值是 promise 对象
let p = mongoose.connect('mongodb://127.0.0.1:27017/h5220731')

p.then(() => {
  //连接成功的回调
  console.log('连接成功');
  
}, () => {
  //连接失败的回调
  console.log('连接失败~~');
});